import request from '@/utils/request'

// 查询维修任务列表
export function listRepair(query) {
  return request({
    url: '/business/repair/list',
    method: 'get',
    params: query
  })
}

// 查询维修任务详细
export function getRepair(id) {
  return request({
    url: '/business/repair/' + id,
    method: 'get'
  })
}

// 新增维修任务
export function addRepair(data) {
  return request({
    url: '/business/repair',
    method: 'post',
    data: data
  })
}

// 修改维修任务
export function updateRepair(data) {
  return request({
    url: '/business/repair',
    method: 'put',
    data: data
  })
}

// 删除维修任务
export function delRepair(id) {
  return request({
    url: '/business/repair/' + id,
    method: 'delete'
  })
}

// 派遣维修任务
export function dispatchTask(params) {

  // 成功  后端接参数时用dto接，且要在参数里加个@RequestBody注解
  return request.post('/business/repair/task', params);
  // return request({
  //   url: '/business/repair/task',
  //   method: 'post',
  //   data: data
  // })
}

// 获取信箱中的维修任务

export function getTask() {
  return request({
    url: '/business/repair/getRepairTask',
    method: 'get',
  })
}


// 删除信箱中的维修任务
export function delTask(id) {
  return request({
    url: '/business/repair/deleteTaskCode/' + id,
    method: 'delete'
  })
}

// 管理员获取消息
export function getMsgByAdmin(){
  return request({
    url: '/business/repair/getMsgByAdmin',
    method: 'get'
  })
}

// 获取维修任务总数和已复核任务总数
export function getRepairAndCompleted(){
  return request({
    url: '/business/repair/getRepairAndCompleted',
    method: 'get'
  })
}